package com.cskaoyan.shopping.service.impl;

import com.cskaoyan.shopping.converter.ContentConverter;
import com.cskaoyan.shopping.dal.entitys.PanelContent;
import com.cskaoyan.shopping.dal.persistence.PanelContentMapper;
import com.cskaoyan.shopping.dto.PanelContentDto;
import com.cskaoyan.shopping.service.INavigationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

/***
 * title INavigationServiceImpl
 * @description <TODO description class purpose>
 * @author ZCZ
 * @version 1.0.0
 * @create 2022/9/21 14:40
 **/
@Service
public class INavigationServiceImpl implements INavigationService {
    @Autowired
    PanelContentMapper panelContentMapper;
    @Autowired
    ContentConverter contentConverter;

    @Override
    public List<PanelContentDto> navigation() {
        LinkedList<PanelContentDto> panelContentDtos = new LinkedList<>();
        List<PanelContent> panelContents = panelContentMapper.selectByPanelId(0);
        for (PanelContent panelContent : panelContents) {
            PanelContentDto panelContentDto = contentConverter.panelContent2Dto(panelContent);
            panelContentDtos.add(panelContentDto);
        }
        return panelContentDtos;
    }
}
